part of '../../flutter_ns_ble.dart';

extension DFU on Peripheral {
  Stream<DFUStateEvent> get dfuState => _events
      .where((e) => e is DFUStateEvent && e.address == address)
      .cast<DFUStateEvent>()
      .shareValueSeeded(DFUStateEvent(address: address, state: DFUState.idle))
      ;

  Future<void> startDFU(String filePath) async {
    await _methods.startDFU(address, filePath);
  }

  Future cancelDFU() async {
    await _methods.cancelDFU(address);
  }
}
